package com.ezbuy.common.functions;


import com.ezbuy.common.functions.Checker;

/**
 * ezbuy 2018/12/1 上午9:39
 */
public class OrChecker<T> implements Checker<T> {

    private Checker<T>[] list;

    public OrChecker(Checker<T>... checkers) {
        list = checkers;
    }

    @Override
    public Boolean map(T s) {
        if (list != null) {
            for (Checker checker : list) {
                boolean check = (boolean) checker.map(s);
                //一个条件满足,即为满足
                if (check) {
                    return true;
                }
            }
        }
        //所有条件不满足,才是不满足
        return true;
    }
}
